Repository navigation
fix(tcp): return one line per passive receive - #102
Merged
Merged
Conversation
A program asking for the next line receives just one line, including its line ending. An unfinished line stays available after a timeout. Closing the connection tells a waiting program that the connection closed. Lines longer than 300,000 bytes return an error. A program can still recover the original bytes by turning off line processing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When an Erlang program asked for the next line from a TCP connection, Nera could hand it several separate commands as one.
What changed
Before and after
Before: One read returned all 14 bytes of three queued lines together.
After: Three reads return 8, 5 and 1 bytes separately, keeping both line endings and the empty line.
This changes what a program receives, not a screen; the socket transcripts show the returned values.
Checked
Live validation: Demonstrated for this version. 3 of 3 scenarios driven live in the product.
How it was checked
Built the release runtime before the compiler. Ran strict workspace Clippy, the complete Rust workspace, and all three native end-to-end shards on Linux.
Ran each native fixture ten times with default schedulers and ten with one scheduler. The ordinary-line transcript matched both BEAM backends.
The change-map, allocator configuration, stacktrace order, and native test-storage checks passed. Cross-object checks produced Mach-O x86-64 and ELF AArch64 objects.
Risk
Risk above low: Blast radius, medium — TCP reads share the socket buffer and reactor close handling.; Evidence, medium — Linux is proven end to end; Windows close behavior is source-reviewed and type-checked.
Full risk assessment
Not done
Approving adds this change to the next batch. The app merges the batch only if the project’s hosted checks pass.
Positive-length reads and partial lines buffered before leaving active mode are unchanged. Native Windows runtime behavior was not exercised.